﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace GameVLTK
{
    public class ProductionManager:VisibleGameEntity
    {

        private List<Production> _Productions;

        public List<Production> Productions
        {
            get { return _Productions; }
            set { _Productions = value; }
        }

      
        public ProductionManager()
        {
            this.Productions = new List<Production>();
           
        }

        public override void Update(GameTime gameTime)
        {
            GartherInput(Mouse.GetState());

            for (int i = 0; i < this.Productions.Count; i++)
                this.Productions[i].Update(gameTime);
        }

        /// <summary>
        /// Kiểm tra input đầu vào đối với đối tượng Killer
        /// </summary>
        public void GartherInput(MouseState mouseState)
        {
            for (int i = 0; i < this.Productions.Count; i++)
                if (this.Productions[i].IsClicked(mouseState))
                {
                    Global.BroadCastEvents(Global.EVENTS.GM_PRODUCTION_CLICKED,
                                                this.Productions[i], null, null);
                }
        }

        /// <summary>
        /// 
        /// </summary>
       
        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            for (int i = 0; i < this.Productions.Count; i++)
                this.Productions[i].Draw(gameTime, spriteBatch);
        }


    }
}
